package licode.unisop.types.dp;

import cn.hutool.core.util.PhoneUtil;
import org.springframework.util.Assert;

public class Mobile {

    public static final Mobile EMPTY = new Mobile("");

    private final String mobile;

    public Mobile(String mobile) {
        Assert.isTrue(mobile == null ||
                        mobile.length() == 0 ||
                        PhoneUtil.isMobile(mobile),
                "手机号码错误：" + mobile);
        this.mobile = mobile;
    }

    public String getMobile() {
        return mobile;
    }

    @Override
    public String toString() {
        return mobile;
    }
}
